/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.entidad;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 841756
 */
@Entity
@Table(name = "tblpaises")
@NamedQueries({
    @NamedQuery(name = "Tblpaises.findAll", query = "SELECT t FROM Tblpaises t"),
    @NamedQuery(name = "Tblpaises.findByCodPais", query = "SELECT t FROM Tblpaises t WHERE t.codPais = :codPais"),
    @NamedQuery(name = "Tblpaises.findByNomPais", query = "SELECT t FROM Tblpaises t WHERE t.nomPais = :nomPais")})
public class Tblpaises implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 3)
    @Column(name = "cod_pais")
    private String codPais;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 40)
    @Column(name = "nom_pais")
    private String nomPais;
    @JoinColumn(name = "id_estado", referencedColumnName = "id_estado")
    @ManyToOne(optional = false)
    private TblEstado idEstado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pais")
    private List<Tblcompania> tblcompaniaList;
    @OneToMany(mappedBy = "nacionalidad")
    private List<Tbldatospersonales> tbldatospersonalesList;

    public Tblpaises() {
    }

    public Tblpaises(String codPais) {
        this.codPais = codPais;
    }

    public Tblpaises(String codPais, String nomPais) {
        this.codPais = codPais;
        this.nomPais = nomPais;
    }

    public String getCodPais() {
        return codPais;
    }

    public void setCodPais(String codPais) {
        this.codPais = codPais;
    }

    public String getNomPais() {
        return nomPais;
    }

    public void setNomPais(String nomPais) {
        this.nomPais = nomPais;
    }

    public TblEstado getIdEstado() {
        return idEstado;
    }

    public void setIdEstado(TblEstado idEstado) {
        this.idEstado = idEstado;
    }

    public List<Tblcompania> getTblcompaniaList() {
        return tblcompaniaList;
    }

    public void setTblcompaniaList(List<Tblcompania> tblcompaniaList) {
        this.tblcompaniaList = tblcompaniaList;
    }

    public List<Tbldatospersonales> getTbldatospersonalesList() {
        return tbldatospersonalesList;
    }

    public void setTbldatospersonalesList(List<Tbldatospersonales> tbldatospersonalesList) {
        this.tbldatospersonalesList = tbldatospersonalesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codPais != null ? codPais.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tblpaises)) {
            return false;
        }
        Tblpaises other = (Tblpaises) object;
        if ((this.codPais == null && other.codPais != null) || (this.codPais != null && !this.codPais.equals(other.codPais))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + nomPais + "";
    }
    
}
